package com.csweimei.rentmanagementtreasure.http.entity;

import android.view.View;

import com.csweimei.rentmanagementtreasure.utils.ValidateUtils;
import com.google.gson.annotations.SerializedName;

import java.util.List;

public class HouseListEntBean extends BaseResult{
    @SerializedName("data")
    private List<DataDTO> data;

    public List<DataDTO> getData() {
        return data;
    }

    public void setData(List<DataDTO> data) {
        this.data = data;
    }

    public static class DataDTO {
        @SerializedName("userid")
        private int userid;
        @SerializedName("headImg")
        private String headImg;
        @SerializedName("nickname")
        private String nickname;
        @SerializedName("Count")
        private int count;
        @SerializedName("hList")
        private List<HListDTO> hList;

        public int getUserid() {
            return userid;
        }

        public void setUserid(int userid) {
            this.userid = userid;
        }

        public String getHeadImg() {
            return headImg;
        }

        public void setHeadImg(String headImg) {
            this.headImg = headImg;
        }

        public String getNickname() {
            return nickname;
        }

        public void setNickname(String nickname) {
            this.nickname = nickname;
        }

        public String getCount() {
            return "共"+count+"套";
        }

        public void setCount(int count) {
            this.count = count;
        }

        public List<HListDTO> getHList() {
            return hList;
        }

        public void setHList(List<HListDTO> hList) {
            this.hList = hList;
        }

        public static class HListDTO {
            @SerializedName("quarters")
            private String quarters;
            @SerializedName("housingCount")
            private int housingCount;
            @SerializedName("qList")
            private List<QListDTO> qList;

            public String getQuarters() {
                return quarters;
            }

            public void setQuarters(String quarters) {
                this.quarters = quarters;
            }

            public String getHousingCount() {
                return "(共"+housingCount+"套)";
            }

            public void setHousingCount(int housingCount) {
                this.housingCount = housingCount;
            }

            public List<QListDTO> getQList() {
                return qList;
            }

            public void setQList(List<QListDTO> qList) {
                this.qList = qList;
            }

            public static class QListDTO {
                @SerializedName("housingId")
                private int housingId;
                @SerializedName("housingImg")
                private String housingImg;
                @SerializedName("roomname")
                private String roomname;
                @SerializedName("rent")
                private String rent;
                @SerializedName("status")
                private int status;


                public String getUrl(){
                    if (ValidateUtils.isNotEmptyString(housingImg)){
                        if (housingImg.contains(",")){
                            String[] strings = housingImg.split(",");
                            return strings[0];
                        }
                    }
                    return "";
                }


                public String getUrlNum(){
                    if (ValidateUtils.isNotEmptyString(housingImg)){
                        if (housingImg.contains(",")){
                            String[] strings = housingImg.split(",");
                            return "+"+strings.length;
                        }
                    }
                    return "0";
                }

                public int get0(){
                    if (status == 0){
                        return View.VISIBLE;
                    }else {
                        return View.GONE;
                    }
                }

                public int get1(){
                    if (status == 1){
                        return View.VISIBLE;
                    }else {
                        return View.GONE;
                    }
                }

                public int get2(){
                    if (status == 2){
                        return View.VISIBLE;
                    }else {
                        return View.GONE;
                    }
                }


                public int getHousingId() {
                    return housingId;
                }

                public void setHousingId(int housingId) {
                    this.housingId = housingId;
                }

                public String getHousingImg() {
                    return housingImg;
                }

                public void setHousingImg(String housingImg) {
                    this.housingImg = housingImg;
                }

                public String getRoomname() {
                    return roomname;
                }

                public void setRoomname(String roomname) {
                    this.roomname = roomname;
                }

                public String getRent() {
                    if (ValidateUtils.isEmptyString(rent)){
                        return "面议";
                    }else {
                        return rent+"元/月";
                    }
                }

                public void setRent(String rent) {
                    this.rent = rent;
                }

                public int getStatus() {
                    return status;
                }

                public void setStatus(int status) {
                    this.status = status;
                }
            }
        }
    }
}
